<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width: initial-scale=1.0" />
    <title>Document</title>
    <script>
      function chengji(n) {
        var nums = 0,
          count = 0;
        for (var i = 0; i < n.length; i++) {
          nums +=n[i];
          // console.log(nums);
          var average = Math.round(nums /n.length);
          if (n[i] >= average) {
            // console.log(classArray[i]);
            count++;
            // console.log("人数是："+count);
          }
        }
        console.log("平均分是：" + average, "超出平均分的人数是：" + count);
      }
      var classArray = [59, 37, 64, 87, 25, 55, 94, 48, 32];
      chengji(classArray);
    </script>
  </head>
  <body></body>
</html>
